package cn.leizp.springboot.auth.frontweb.service;

import cn.leizp.springboot.auth.frontweb.entity.Resource;
import cn.leizp.springboot.auth.frontweb.repository.ResourceRepository;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class ResourceService {
    private final ResourceRepository resourceRepository;

    public ResourceService(ResourceRepository resourceRepository) {
        this.resourceRepository = resourceRepository;
    }

    public Resource save(Resource resource) {
        return resourceRepository.save(resource);
    }

    public Optional<Resource> findById(Integer id) {
        return resourceRepository.findById(id);
    }

    public List<Resource> findAll() {
        return resourceRepository.findAll();
    }

    public void deleteById(Integer id) {
        resourceRepository.deleteById(id);
    }
}
